package com.hx.observer.advice;

import java.util.Observable;
import java.util.Observer;

/**
 * @author Huathy
 * @date 2021-09-06 21:58
 * @description 观察者，观察论坛社区
 */
public class User implements Observer {

    private String name;

    public User(String name) {
        this.name = name;
    }

    @Override
    public void update(Observable o, Object arg) {
        Forum forum = (Forum) o;
        Info info = (Info) arg;
        System.out.println("==========================");
        System.out.println(forum.getName()+"用户："+name + "您好！" +
                "您有一条来自"+info.getUname()+"的消息，内容："+info.getMsg()+"");
    }
}
